#region License
// Post.cs
// 
// Copyright (c) 2012 Xoqal.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion

namespace Kaqaz.Entities
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using Xoqal.Globalization;
    using Xoqal.Web.Mvc.Globalization;

    /// <remarks>
    /// I don't want LastUpdateTime to be updated automatically so I didn't inherit from Xoqal.Data.Models.ILastUpdateTime
    /// </remarks>
    public partial class Post : Xoqal.Data.Models.ICreateTime
    {
        public Post()
        {
            this.Comments = new List<Comment>();
            this.Tags = new List<Tag>();
        }

        public long Id { get; set; }

        [Required(ErrorMessageResourceName = "RequiredFieldMessage", ErrorMessageResourceType = typeof(Resources.Resource))]
        [DisplayName(typeof(Resources.Resource), "Title")]
        public string Title { get; set; }

        [Required(ErrorMessageResourceName = "RequiredFieldMessage", ErrorMessageResourceType = typeof(Resources.Resource))]
        [DisplayName(typeof(Resources.Resource), "Summary")]
        [UIHint("RichEditor")]
        public string Summary { get; set; }

        [Required(ErrorMessageResourceName = "RequiredFieldMessage", ErrorMessageResourceType = typeof(Resources.Resource))]
        [DisplayName(typeof(Resources.Resource), "Content")]
        [UIHint("RichEditor")]
        public string Content { get; set; }

        public decimal Hits { get; set; }

        [DisplayName(typeof(Resources.Resource), "IsCommentsEnable")]
        public bool IsCommentsEnable { get; set; }

        [DisplayName(typeof(Resources.Resource), "NeedCommentApprove")]
        public bool NeedCommentApprove { get; set; }

        public DateTime CreateTime { get; set; }

        public DateTime? LastUpdateTime { get; set; }

        public virtual ICollection<Comment> Comments { get; set; }

        public virtual ICollection<Tag> Tags { get; set; }
    }
}
